AI Diagnostics: Enforce Centralized Type Registry and Actionable Type Hygiene Fixes#62107
AI Diagnostics: Enforce Centralized Type Registry and Actionable Type Hygiene Fixes#62107MyndScript wants to merge 2 commits intomicrosoft:mainfrom
Conversation
|
@MyndScript please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
|
Please refer to CONTRIBUTING.md to understand pull request requirements |
This PR introduces and enforces a centralized type registry policy for TypeScript projects with AI-enhanced diagnostics. It includes:
Detection of type/interface/class/enum declarations defined outside the central types/ directory.
Actionable, explainable diagnostics with high-confidence, one-click fix suggestions to move types to the registry and update imports.
Expanded convertToAIDiagnostics logic for robust "why" explanations and type hygiene enforcement.
Thorough test coverage for type centralization scenarios.
Documentation updates in AI_DIAGNOSTICS_GUIDE.md to make the policy official and provide integration guidance.
This change helps prevent type sprawl and ambiguity, improves maintainability, and enables better AI-driven code generation and analysis.
Checklist:
Associated issue in Backlog milestone
Code is up-to-date with main
All tests pass (npx hereby runtests-parallel)
Lint and format clean (npx hereby lint & npx hereby format)
New/updated tests for type hygiene and centralization
Closes # (replace with actual issue number).